package edu.sctu.alex.projectPratice.test20150628;

import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

/**
 * Created by alex on 2015/6/28.
 */
public class JsonGet {

    public String  getJsonInfo(String path){

        StringBuffer jsonInfo = new StringBuffer();
        
        String line="";

        try {
            URL url = new URL(path);

            URLConnection urlConnection = url.openConnection();

            InputStream inputStream = urlConnection.getInputStream();

            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));

            while ((line = bufferedReader.readLine()) != null) {

                jsonInfo.append(line);
            }


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }



        return  jsonInfo.toString();
    }


}
